class Cartasur::List < Cartasur::CartasurModel
  #enter list types here
  #list type no. 1 - places
  TYPES = {
     places: 1,
     questions: 3
  }

  attr_accessible :listtype, :name, :sublistype

  def relatedlists

  end

  def self.getlist(type, subtype=nil)
    list = self.where(:listtype => type)
    list = list.where(:listsubtype => subtype) unless subtype.nil?
    list.order(:sequence,:name)
  end

  def self.nextlistno
    max = self.maximum(:listtype)
    1 if max.nil?
    max + 1
  end

end